/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2024-06-10
 * Time: 23:07
 */

class Outclass{
    public int num1 = 1;
    public int num2 = 2;
    public static int num3 = 3;

    class Innerclass{
        public int num1 = 11;
        public int num4 = 4;
        public int num5 = 5;

        public static final int num6 = 6;
        public void test(){
            System.out.println("外部类中的重名成员变量：" + Outclass.this.num1);
            System.out.println("====================");
            System.out.println("内部类中的重名成员变量：" + num1);
            System.out.println("内部类中的重名成员变量：" + this.num1);
            System.out.println("====================");
            System.out.println("外部类中的重名成员变量：" + num2);
            System.out.println("外部类中的重名成员变量：" + num3);
            System.out.println("====================");
            System.out.println("内部类中的重名成员变量：" + num4);
            System.out.println("内部类中的重名成员变量：" + num5);
            System.out.println("内部类中的test方法");
        }
    }

    public void test(){
        System.out.println("外部类中的重名成员变量：" + this.num1);
        System.out.println("外部类中的重名成员变量：" + num2);
        System.out.println("====================");
        Innerclass innerclass = new Innerclass();
        System.out.println("内部类中的重名成员变量：" + innerclass.num4);
        System.out.println("内部类中的重名成员变量：" + innerclass.num5);
        System.out.println("====================");
        System.out.println("外部类中的test方法");
    }
}
public class TestDemo6 {
    public static void main(String[] args) {
        Outclass outclass = new Outclass();
        outclass.test();
        System.out.println("===================");
        Outclass.Innerclass innerclass = outclass.new Innerclass();
        innerclass.test();
    }
}
